package dsk.demo.product.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import dsk.demo.product.dao.SupplierDao;
import dsk.demo.product.dto.SupplierQueryDto;
import dsk.demo.product.entity.SupplierEntity;
import dsk.demo.product.service.SupplierService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SupplierServiceImpl extends ServiceImpl<SupplierDao, SupplierEntity> implements SupplierService {

    @Override
    public IPage<SupplierEntity> queryByPage(SupplierQueryDto dto) {
        Page<SupplierEntity> page = new Page<>(dto.getPage(),dto.getLimit());
        IPage<SupplierEntity> supplierEntityIPage = this.baseMapper.selectSupplierByPage(page, dto);
        return supplierEntityIPage;
    }

    @Override
    public List<SupplierEntity> queryByKeyWord(String keyWord) {
        return this.baseMapper.selectSupplierByKeyWord(keyWord);
    }
}
